<?php

class Application_Model_Stranka
{

    protected $_emso;
    protected $_ime;
    protected $_priimek;
    protected $_email;
    protected $_naslov;
    protected $_telefon;
    protected $_geslo;
    protected $_aktiviran;
    protected $_token;

    public function __construct(array $options = null)
    {
        if (is_array($options)) {
            $this->setOptions($options);
        }
    }

    public function __set($name, $value)
    {
        $method = 'set' . $name;
        if (('mapper' == $name) || !method_exists($this, $method)) {
            throw new Exception('Invalid stranka property');
        }
        $this->$method($value);
    }

    public function __get($name)
    {
        $method = 'get' . $name;
        if (('mapper' == $name) || !method_exists($this, $method)) {
            throw new Exception('Invalid stranka property');
        }
        return $this->$method();
    }

    public function setOptions(array $options)
    {
        $methods = get_class_methods($this);
        foreach ($options as $key => $value) {
            $method = 'set' . ucfirst($key);
            if (in_array($method, $methods)) {
                $this->$method($value);
            }
        }
        return $this;
    }

    public function setIme($text)
    {
        $this->_ime = (string) $text;
        return $this;
    }

    public function getIme()
    {
        return $this->_ime;
    }

    public function setPriimek($priimek)
    {
        $this->_priimek = (string) $priimek;
        return $this;
    }

    public function getPriimek()
    {
        return $this->_priimek;
    }

    public function setGeslo($ts)
    {
        $this->_geslo = $ts;
        return $this;
    }

    public function setEmail($email)
    {
        $this->_email = $email;
        return $this;
    }

    public function setNaslov($naslov)
    {
        $this->_naslov = $naslov;
        return $this;
    }

    public function setTelefon($telefon)
    {
        $this->_telefon = $telefon;
        return $this;
    }

    public function getGeslo()
    {
        return $this->_geslo;
    }

    public function getToken() {
        return $this->_token;
    }

    public function setToken($token) {
        $this->_token = $token;
        return $this;
    }

    public function setEmso($id)
    {
        $this->_emso = $id;
        return $this;
    }

    public function setAktiviran($akt)
    {
        $this->_aktiviran = $akt;
        return $this;
    }

    public function getEmso()
    {
        return $this->_emso;
    }

    public function getEmail()
    {
        return $this->_email;
    }

    public function getTelefon()
    {
        return $this->_telefon;
    }

    public function getNaslov()
    {
        return $this->_naslov;
    }

    public function getAktiviran()
    {
        return $this->_aktiviran;
    }


    public function getEditUrl($baseUrl)
    {
        return $baseUrl."/prodaja/edit-stranka/?id=".base64_encode($this->getEmso());
    }

    public function getDeleteUrl($baseUrl)
    {
        return $baseUrl."/prodaja/delete-stranka/?id=".base64_encode($this->getEmso());
    }

    public function getActivateUrl($baseUrl)
    {
        return $baseUrl."/prodaja/aktiviraj-stranko/?id=".base64_encode($this->getEmso());
    }
    public function getDeactivateUrl($baseUrl)
    {
        return $baseUrl."/prodaja/deaktiviraj-stranko/?id=".base64_encode($this->getEmso());
    }

}

